home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
-
- # Send the output mime type to the server to know what output to handle.
-
- print "Content-type: text/html\n\n";
-
- # Print HTML header information.
-
- print <<EOH;
- <HTML>
- <HEAD><TITLE>CGI Script How-to: Test Script</TITLE></HEAD>
- <BODY>
- <H1>CGI Script How-to<BR>determine the client machine's name</H1>
- EOH
-
- # Access the environment variable by name
-
- if ($ENV{'REMOTE_HOST'})
- {
- $remote_host = $ENV{'REMOTE_HOST'};
- }
- elsif ($ENV{'REMOTE_ADDR'})
- {
- $remote_host = $ENV{'REMOTE_ADDR'};
- }
- else
- {
- $remote_host = "somewhere on the Internet";
- }
-
- print "Hello, you are a user from <B>$remote_host</B>\n";
-
- # Print closing HTML tags.
-
- print "</BODY></HTML>\n";
-
- #
- # end of testhost.pl
- #
-